package data;

import java.util.Base64;

public class User
{

	
	/**
	 * 作session存attribute时用的name
	 * */
	public enum Attribute
	{
		ID,
		USERNAME,
		PASSWORD,
		BASE64_USERNAME,
		BASE64_PASSWORD;
		
		public String getFullName()
		{
			return this.getDeclaringClass().getName() + "." + this.name();
		}
	}
	
	
	protected int id;
	private String nickname;
	protected String username;
	protected String password;
	
	public User(int id, String username, String password)
	{
		this.setID(id);
		this.username = username;
		this.password = password;
	}
	
	
	public void setID(int id) { this.id = id; }
	public void setNickname(String nickname) { this.nickname = nickname; }
	
	
	public final int getID() { return this.id; }
	public String getNickname() { return this.nickname; }
	public final String getUsername() { return this.username; }
	public final String getPassword() { return this.password; }
	public final String getBase64Username() { return Base64.getEncoder().encodeToString(this.username.getBytes()); };
	public final String getBase64Password() { return Base64.getEncoder().encodeToString(this.password.getBytes()); }
	
	
	
}















